require(["jquery",'public'],function($,public) {
    public.header();
    var shopmall = public.getUrlParam('shopmall') || 1; // 1:县会长  2:一带一路
    if(shopmall == 1){
    	public.footer(2);
    }else{
    	public.footer(3);    	
    }
    public.allocator();

    function getData(shopmall){
    	$.ajax({
            type: 'post',
            dataType: 'json',
            data: {type: shopmall},
            url: MODULE+'Shopmall/index',           
        }).success(function (res) {
            console.log(res);
            if(!res.data || !res.data.length){
            	$('.shop_list').addClass('shoplist_none');
            	return false;
            }
            var str = '';
            res.data.forEach(function(i){
	            str 	+= '<div class="shop_item">'
						+		'<div class="shop_info">'
						+			'<div class="fl">'
						+				'<div class="img_box">'
						+					'<img class="shop_link" src="'+PUBLIC+i.user_picture_path+'" alt="" />'
						+				'</div>'
						+				'<div class="text_box">'
						+					'<strong>'+i.user_username+'</strong>'
						+					'<p>'
						+						'<span>销量'+i.user_sales+'</span>'
						+						'<span>宝贝'+i.user_baby+'</span>'
						+					'</p>'
						+				'</div>'
						+			'</div>'
						+			'<a class="into_the_store " href="'+MODULE+'PublicJump/shop/id/'+i.user_id+'/shopmall/'+shopmall+'">进店</a>'
						+		'</div>'
						+		'<ul class="shop_product_main">';
					for(var j = 0; j < 3; j++){
						var c = i.child[j];
				str		+=			'<li>'
						+				'<a href="'+(!c?'javascript:;':MODULE+'PublicJump/productInfo/id/'+c.goods_id)+'">'
						+					'<div class="img_box">'
						+						'<img class="shop_goods_link" src="'+(!c?PUBLIC+'img/public/default_goods.png':PUBLIC+c.goods_picture_path)+'" alt="" />'
						+					'</div>'
						+					'<div class="text_box '+(!c?'hide':'')+'">'
						+						'<span>￥'+(!c?'':c.goods_price)+'</span>'
						+					'</div>'
						+				'</a>'
						+			'</li>';
					}
					/*i.child.forEach(function(c){
						
					});*/

				str 	+=		'</ul>'
						+	'</div>';
            });
            $('.shop_list').append(str);

            
        }).fail(function (jqXHR, textStatus, errorThrown) {});
    }

    getData(shopmall);    

    //页面加载完毕
    public.loaded();
})